﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JXT.PrimaryKey.Batman.Validation;
using JXT.PrimaryKey.Batman.Domain.UserSystem.Models;

namespace JXT.PrimaryKey.Batman.Domain.UserSystem.Validation
{
    public class UserValidator : IValidator<User>
    {
        public ValidationResult Validate(User entity)
        {
            ValidationErrorCollection errors = new ValidationErrorCollection();
            if (String.IsNullOrEmpty(entity.Name))
                errors.Add(new ValidationError("Name", entity.Name, "name can not be null or empty!"));
            if (String.IsNullOrEmpty(entity.Mail))
                errors.Add(new ValidationError("Mail", entity.Name, "name can not be null or empty!"));
            return new ValidationResult(errors);
        }
    }
}
